import React, { Component,createRef } from 'react'
export default class App extends Component {
  h1 = createRef()
  render() {
    return (
      <div>

        <h1 ref={this.h1}>h1标签</h1>
        <button onClick={()=>{this.h1.current.innerText="h1"}}>点击</button>
      </div>
    )
  }
}

